texthandle: Use the handle widget style context for rendering
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 20 Nov 2014 12:41:24 +0000 (13:41 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 18 Dec 2014 20:20:17 +0000 (21:20 +0100)
Using the parent widget context is a leftover of the pre-popover
implementation, which used GdkWindows directly. This will make the context
reflect widget state, at the expense of changing the selector paths
that used to match the handles.

gtk/gtktexthandle.c

index 74023f4c4aa0f1de831ca24894ad11657970e1ab..2b426857d10e347c966d2c357b1ed3701655ede8 100644 (file)
@@ -101,7 +101,7 @@ _gtk_text_handle_draw (GtkTextHandle         *handle,
   gint width, height;
 
   priv = handle->priv;
-  context = gtk_widget_get_style_context (priv->parent);
+  context = gtk_widget_get_style_context (priv->windows[pos].widget);
   _gtk_text_handle_get_size (handle, &width, &height);
 
   cairo_save (cr);
@@ -221,6 +221,12 @@ static void
 gtk_text_handle_widget_style_updated (GtkWidget     *widget,
                                       GtkTextHandle *handle)
 {
+  GtkTextHandlePrivate *priv;
+
+  priv = handle->priv;
+  gtk_style_context_set_parent (gtk_widget_get_style_context (widget),
+                                gtk_widget_get_style_context (priv->parent));
+
   _gtk_text_handle_update (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START);
   _gtk_text_handle_update (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END);
 }
@@ -254,6 +260,9 @@ _gtk_text_handle_ensure_widget (GtkTextHandle         *handle,
       priv->windows[pos].widget = g_object_ref_sink (widget);
       window = gtk_widget_get_ancestor (priv->parent, GTK_TYPE_WINDOW);
       _gtk_window_add_popover (GTK_WINDOW (window), widget);
+
+      gtk_style_context_set_parent (gtk_widget_get_style_context (widget),
+                                    gtk_widget_get_style_context (priv->parent));
     }
 
   return priv->windows[pos].widget;